def legal(cmd: str):
    if len(cmd) < 2:
        return False
    if cmd[0] not in ['W', 'A', 'S', 'D']:
        return False
    for c in cmd[1:]:
        if not c.isdigit():
            return False
    return True


cmds = input().split(';')
numCmds = len(cmds)
x = 0
y = 0
for cmd in cmds:
    if not legal(cmd):
        continue
    if cmd[0] == 'W':
        y += int(cmd[1:])
    elif cmd[0] == 'A':
        x -= int(cmd[1:])
    elif cmd[0] == 'S':
        y -= int(cmd[1:])
    elif cmd[0] == 'D':
        x += int(cmd[1:])

print("%d,%d" % (x, y))
